<?php
namespace Admin\Controller;
use Think\Controller;
use Org\Util\String;
use Think\Page;
use Think\Upload;
	class ActLogController extends CommonController{
		public function index(){
			
			$id=$_GET['id'];
			$actlog = M('ActLog'); 
			
			$article = M('Article');
			$art = $article->find($id);
			$this->assign('art',$art);
			
			$keyword = $_GET['keyword'];
			if ($keyword == NULL){
				$count      = $actlog->where('act_id='.$id) ->count();// 查询满足要求的总记录数
				$Page       = new Page($count,9);// 实例化分页类 传入总记录数和每页显示的记录数
				$show       = $Page->show();// 分页显示输出
				// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
				$list = $actlog ->where('act_id='.$id) ->limit($Page->firstRow.','.$Page->listRows)->order('created_at desc')->select();
				$this->assign('data',$list);
				$this->assign('page',$show);
			}else {
				$map['truename'] = array('like','%'.$keyword.'%'); 
				$map['phone'] = array('like','%'.$keyword.'%');
				$map['_logic'] = 'or';
				$where['_complex'] = $map;
				$count      = $actlog-> where($where)-> where('act_id='.$id)->count();// 查询满足要求的总记录数
				$parameter=array(
					'keyword'=>$keyword,
				);
				$Page       = new Page($count,6,$parameter);// 实例化分页类 传入总记录数和每页显示的记录数
				$show       = $Page->show();// 分页显示输出
				// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
				$list = $actlog-> where($where)->where('act_id='.$id) ->limit($Page->firstRow.','.$Page->listRows)->order('created_at desc')->select();
				$this->assign('data',$list);
				$this->assign('page',$show);
				
				$this->assign('keyword',$keyword);
			}
			
			$this->display('ActLog/index');
		}
		
		
		public function del(){
			$m=M('ActLog');
			$id=$_GET['id'];
			$count=$m->delete($id);
			if($count>0){
				$this->show('del');
			}else{
				$this->show('error');
			}
		}
		
		
		
	}
?>
